//package top.zhaoyuliu.logbook.client.aspect;
//
//import java.lang.reflect.Method;
//
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.After;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.springframework.stereotype.Component;
//
//import cn.hutool.core.util.StrUtil;
//import lombok.extern.slf4j.Slf4j;
//import top.zhaoyuliu.logbook.client.constant.Const;
//
///**
// * Copyright © 2021 Arain. All rights reserved.
// *
// * @Title: ComponentAspect.java
// * @Prject: logbook-client
// * @Package: top.zhaoyuliu.logbook.client.aspect
// * @Description: <功能详细描述>
// * @author: Arain
// * @date: 2021年1月23日 上午10:06:52
// * @version: V1.0
// */
//@Aspect
//@Component
//@Slf4j
//public class ComponentAspect {
//
//	@After("@within(top.zhaoyuliu.logbook.client.annotation.EnabledLogbookRecord)")
//	public void getPackage(JoinPoint joinPoint) throws Throwable {
//		String description = getDescription(joinPoint);
//		log.info("配置扫描包 -> {}", description);
//		if (StrUtil.isNotBlank(description)) {
//			Const.SCANCOMPONENT = description;
//			System.setProperty("SCANCOMPONENT", description);
//		}
//	}
//
//	@SuppressWarnings("rawtypes")
//	public static String getDescription(JoinPoint joinPoint) throws Exception {
//		String targetName = joinPoint.getTarget().getClass().getName();
//		String methodName = joinPoint.getSignature().getName();
//		Object[] arguments = joinPoint.getArgs();
//		Class targetClass = Class.forName(targetName);
//		Method[] methods = targetClass.getMethods();
//		String description = null;
//		for (Method method : methods) {
//			if (method.getName().equals(methodName)) {
//				Class[] clazzs = method.getParameterTypes();
//				if (clazzs.length == arguments.length) {
//					description = method
//							.getAnnotation(top.zhaoyuliu.logbook.client.annotation.EnabledLogbookRecord.class).value();
//					break;
//				}
//			}
//		}
//		if(StrUtil.isBlank(description)) {
//			description = targetClass.getPackage().getName();
//		}
//		return description;
//	}
//}
